from bs4 import BeautifulSoup

str = """
<div class="item name" title="中央公园">
<a href="/Attraction_Review-g60763-d105127-Reviews-Central_Park-New_York_City_New_York.html" target="_blank" class="poiTitle" onclick="widgetEvCall('handlers.shelfItemClick', event, this)" data-tpp="Attractions" data-tpact="shelf_item_click" data-tpatt="1|poi|105127" data-tpid="162">
中央公园
</a>
<div class="d_1">
    <span class="s_1">11</span>
    <a href="www.baidu.com"></a>
</div>
<div class="d_1">
    <span class="s_1">22</span>
    <span class="s_1">22_1</span>
    <a href="www.baidu_1.com"></a>
</div>
<div class="d_1">
    <span class="s_1">33</span>
    <a href="www.baidu_2.com"></a>
</div>
</div>
"""

# soup = BeautifulSoup(str,'lxml')
#
# data_list = soup.select('.d_1 a[href]')
# for data in data_list:
#     print(data)
#print(data_list)

# 通过标签名查找
def fun_1():
    soup = BeautifulSoup(str, 'lxml')
    data_list = soup.select('.d_1 > a').get_text()
    print(data_list)


fun_1()


